include ../Makefile.inc

EXE		= dissassembler
INCLUDE_DIR = ../include
LIBS	+=
OBJS	= main.o arg_parser.o common.o xml_parser.o\
	ehdr.o shdr.o phdr.o
SRC		= main.c arg_parser.c common.c xml_parser.c\
	ehdr.c shdr.c phdr.c
.PHONY: clean

all : $(EXE)

$(EXE) : $(OBJS) $(INCLUDE_DIR)/*.h
	$(ECHO) $(CC) -o $(EXE) $(OBJS) $(OBJS) 
	$(CC) -o $(EXE) $(OBJS) $(LIBS)
	$(MV) $(EXE) ../bin
	
ehdr.o : ehdr.c $(INCLUDE_DIR)/ehdr.h
	$(ECHO) $(CC) $(CFLAGS) -c ehdr.c 
	$(CC) $(CFLAGS) -c ehdr.c

shdr.o : shdr.c $(INCLUDE_DIR)/shdr.h
	$(ECHO) $(CC) $(CFLAGS) -c shdr.c 
	$(CC) $(CFLAGS) -c shdr.c
	
phdr.o : phdr.c $(INCLUDE_DIR)/phdr.h
	$(ECHO) $(CC) $(CFLAGS) -c phdr.c 
	$(CC) $(CFLAGS) -c phdr.c
	
main.o : main.c $(INCLUDE_DIR)/*.h
	$(ECHO) $(CC) $(CFLAGS) -c main.c
	$(CC) $(CFLAGS) -c main.c
	
arg_parser.o : arg_parser.c $(INCLUDE_DIR)/arg_parser.h
	$(ECHO) $(CC) $(CFLAGS) -c arg_parser.c 
	$(CC) $(CFLAGS) -c arg_parser.c
	
common.o : common.c $(INCLUDE_DIR)/common.h
	$(ECHO) $(CC) $(CFLAGS) -c common.c 
	$(CC) $(CFLAGS) -c common.c

xml_parser.o : xml_parser.c $(INCLUDE_DIR)/xml_parser.h
	$(ECHO) $(CC) $(CFLAGS) -c xml_parser.c 
	$(CC) $(CFLAGS) -c xml_parser.c
		
clean : 
	$(ECHO) cleaning up in `pwd`
	-$(RM) -f ../bin/$(EXE)
	-$(RM) -f $(EXE) $(OBJS) $(OBJLIBS) *.o
	-for d in $(DIRS); do (cd $$d; $(MAKE) clean ); done
